//----------------------------------*-C++-*----------------------------------//
/*!
 * \file   testFields.cc
 * \author Jeremy Roberts
 * \date   Jul 7, 2011
 * \brief  Test programs for Field and derivative classes.
 * \note   Copyright (C) 2011 Jeremy Roberts. 
 */
//---------------------------------------------------------------------------//
// $Rev::                                               $:Rev of last commit
// $Author::                                            $:Author of last commit
// $Date::                                              $:Date of last commit
//---------------------------------------------------------------------------//

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>

#include "tran/Field.hh"
#include "tran/Cell_Field.hh"
#include "tran/CartMesh.hh"

using namespace std;
using namespace slabtran;

int main(int argc, char *argv[])
{
	Require(argc==2);
	int test = atoi(argv[1]);
	cout << " ------ testField ------ " << endl;

	//---------------------------------------------------
	int    N = 10;
	double v = 0.0;
	Field<double> f(N,v); // size 10, initialized to 0.0
    Field<double>::iterator fval = f.begin();
    for (; fval != f.end(); fval++ )
    {
    	*fval = 1.0;
    	cout << " fvalue = " << *fval << endl;
    }
    cout << " f[0] = " << f[0] << endl;
    //---------------------------------------------------
    // make a 1d mesh using the less simple constructor
    double edges_a[] = {0.0, 1.0, 2.0, 5.0, 10.0};
    int   counts_a[] = {   1,   2,   2,   3     };
    vector<double> edges( edges_a, edges_a+5 );
    vector<int> counts( counts_a, counts_a+4 );
    Base_Mesh::SP_mesh mesh; // from base smart point
    mesh = new Mesh<_1D>(edges,counts);
    Cell_Field<double> cf(mesh,N,v);
    for ( int i = 0; i < N; i++ )
    {
    	cf[i] = 1.0*i;
    }
    Cell_Field<double>::iterator cfval = cf.begin();
    for (; cfval != cf.end(); cfval++ )
    	cout << " cfvalue = " << *cfval << endl;
    //---------------------------------------------------

	cout << " done. " << endl;

	return 0;
}

//---------------------------------------------------------------------------//
//              end of testFields.cc
//---------------------------------------------------------------------------//
